//
//  CheckBoxCell.m
//  MoneyIndividual
//
//  Created by Le Anh Tai on 1/9/14.
//  Copyright (c) 2014 Le Anh Tai. All rights reserved.
//

#import "CheckBoxCell.h"

@implementation CheckBoxCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        _checkBox = [[CTCheckbox alloc] init];
        [_checkBox addTarget:self action:@selector(checkboxDidChanged:) forControlEvents:UIControlEventValueChanged];
        [self.contentView addSubview:_checkBox];
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGRect frame = self.contentView.frame;
    _checkBox.frame = CGRectMake(20, 0, frame.size.width - 20, frame.size.height);
}

#pragma mark - Delegate
- (void)checkboxDidChanged:(CTCheckbox *)checkbox
{
    if (checkbox.checked)
    {
        
    }
}

@end


